module Vote.Internal.Aeson where

import Data.Aeson (Options, defaultOptions)
import qualified Data.Aeson as A
import Data.OpenApi (fromAesonOptions, SchemaOptions)
import Protolude (Bool (False, True), drop, map, toLower)

toJSONOptions :: Options
toJSONOptions = defaultOptions {A.allNullaryToStringTag = False, A.sumEncoding = A.UntaggedValue, A.constructorTagModifier = map toLower, A.fieldLabelModifier = drop 1, A.omitNothingFields = True}

schemaOptions :: SchemaOptions
schemaOptions = fromAesonOptions toJSONOptions